﻿using System;
using System.Globalization;
using System.Windows.Data;

namespace Bazookabird.Wpf.Queries.QueryHandlers.SimpleSprintViewer
{
    public class WorkItemScaleConverter : IMultiValueConverter
    {
        public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
        {
            if (values == null) return null;

            var currentValue = (double?) values[0];
            var maxValue = values[1] as double?;

            if (maxValue < 0.05) return 0;
            return currentValue/maxValue;
        }

        public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
